package waggle.server;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

import waggle.client.services.UserService;
import waggle.client.bean.User;
import waggle.client.bean.Role;
import waggle.client.bean.Email;
import waggle.client.bean.EmailException;
import waggle.client.bean.UserExistedException;
import waggle.client.UserQuery;
/**
 * This class implements UserServer for all user related Async calls
 * 
 */
public class UserServiceImpl extends RemoteServiceServlet implements
    UserService {

	  public User removeRoles(String sessionId, User user, List<Role> roles)
      throws UserServiceException {
		  return null;
	  }

	  public UserQuery fetchUser(String sessionId, UserQuery query)
      throws UserServiceException {
		  return null;
	  }

	  /**
	   * This method looks up the user information by email address. If there is
	   * such user, it checks if the given password and the stored password. If they
	   * match, return the User object. If they do not match, return null.
	   * 
	   * @see org.rebioma.client.services.UserService#signIn(java.lang.String,
	   *      java.lang.String)
	   */
	  public User signIn(String email, String password) {
		  return null;
	  }

	  public boolean update(String userSessionId, User user, String newPass)
      throws UserServiceException {
		  return false;
	  }

	  /**
	   * Editing user profiler is not yet implemented.
	   * 
	   * @param sessionId
	   * @param query
	   * @return
	   * @throws UserServiceException
	   */
	  public int update(String sessionId, UserQuery query)
	      throws UserServiceException {
		  return 0;
	  }
	  
	  /**
	   * This method looks up for user information by the given email. If there is
	   * such user, return true.
	   * 
	   * @see org.rebioma.client.services.UserService#userEmailExists(org.rebioma.client.bean.User,
	   *      boolean)
	   */
	  public boolean userEmailExists(String email) {
		  return false;
	  }
	  
	  /*
	   * (non-Javadoc)
	   * 
	   * This method looks up the user infomation by sessionId. If the sessionId is
	   * existed, it checks the old password with the stored password. If match, it
	   * updates the user's password with the new password.
	   * 
	   * @see
	   * org.rebioma.client.services.UserService#changeUserPassword(java.lang.String
	   * , java.lang.String)
	   */
	  public int changeUserPassword(String oldPass, String newPass,
	      String sessionId, Email email) {
		  return 0;
	  }

	  /**
	   * This method creates a random password and store given user with the random
	   * password hash to the database. It then sends a welcome email to the user's
	   * email address.
	   * 
	   * @see org.rebioma.client.services.UserService#register(org.rebioma.client.bean.User,
	   *      Email)
	   */
	  public void register(User user, Email welcomeEmail) throws EmailException,
	      UserExistedException {
		return;  
	  }
	  
	  /**
	   * This method looks up the user information by the given email address. If
	   * there is such user, it randomly generates a password and send it to user's.
	   * email.
	   * 
	   * @see org.rebioma.client.services.UserService#resetPassword(java.lang.String,
	   *      org.rebioma.client.Email)
	   */
	  public void resetUserPassword(String emailAddr, Email email) {
		  return;
	  }

	  public User addRoles(String sessionId, User user, List<Role> roles)
      throws UserServiceException {
		  return null;
	  }

	  public List<Role> getAvailableRoles() {
		  return null;
	  }

	  /**
	   * (non-Javadoc)
	   * 
	   * This method looks up the given sessionId. If there is no such sessionId,
	   * then this sessionId is not valid (i.e return false).
	   * 
	   * @throws UserServiceException
	   * 
	   * @see org.rebioma.client.services.UserService#isSessionIdValid(java.lang.String)
	   */
	  public User isSessionIdValid(String sessionId) throws UserServiceException {
		  return null;
	  }

	  public void signOut(String sessionId) {
		  return;
	  }

}

